﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy.Security;
using Nancy.ModelBinding;
using PlatWL.Data;
using PlatWL.Services.ServicesWeb;

namespace PlatWL.Modules.Web
{
    public class BaseModule : MsgModule
    {
        public BaseModule(BaseManage service) : base("base")
        {
            #region 类型 /cate
            //获取对应子分类列表
            Get["/cate/list/{infotype}/{topid?0}"] = p =>
            {
                service.GetTypeList(ref msg, user_account, Client, p.infotype, p.topid);
                return Response.AsJson(msg);
            };

            //获取所有分类，包括二级分类
            Get["/cate/listall/{infotype?1}"] = p =>
            {
                string ctype = this.Request.Query["ctype"];
                service.GetTypeList2(ref msg, user_account, Client, p.infotype ?? "1", ctype ?? "1");
                return Response.AsJson(msg);
            };
            #endregion

        }
    }
}